package com.wzh.navcode.factory;

import com.wzh.navcode.service.CrawlStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.Map;

/**
 * @Author: wangzh
 * @Version: 1.0
 * @Description: 爬取数据策略工厂
 */
@Component
@RequiredArgsConstructor
public class CrawlStrategyFactory {

    private final Map<String, CrawlStrategy> strategyMap;

    public CrawlStrategy getStrategy(String platform) {
        CrawlStrategy strategy = strategyMap.get(platform + "Strategy");
        if (strategy == null) {
            throw new IllegalArgumentException("Unsupported platform: " + platform);
        }
        return strategy;
    }
}
